package cn.wolfcode.luowowo.web.controller;

import cn.wolfcode.luowowo.domain.Banner;
import cn.wolfcode.luowowo.query.BannerQuery;
import cn.wolfcode.luowowo.service.IBannerService;
import cn.wolfcode.luowowo.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("index")
public class IndexController {

    @Autowired
    private IBannerService bannerService;

    //游记banner，前面5个
    @GetMapping("/banners/travel")
    public Object travel(BannerQuery qo){
        List<Banner> list = bannerService.queryTop5Travel(Banner.TYPE_TRAVEL);
        return JsonResult.success(list);

    }
    //攻略
    @GetMapping("/banners/strategy")
    public Object strategy(BannerQuery qo){
        List<Banner> list = bannerService.queryTop5Travel(Banner.TYPE_STRATEGY);
        return JsonResult.success(list.get(0));
    }

}
